<?php

	require 'config.php';
	require 'blog-side.php';

	$title = 'blog页面';
	$cid = intval($_GET['id']);
	
	$page = intval($_GET['page'])?(intval($_GET['page'])<2?header('location:/blog.html'):intval($_GET['page'])):1;
	
	$unit = 10;
	$condition = array('cates'=>$id,'type'=>1,'DESC'=>'addtime','LIMIT'=>($unit*($page-1)).','.$unit);
	$list = $_->articles->_select('',array_filter($condition));
	$totalpage = 5;
	$page > $totalpage ? header('location:/blog.php?page='.$totalpage):'';

	$url = $cid ? '/blog.php?id='.$cid.'&' : $url = '/blog.php?';
	
	$smarty->_assign(array('title','list','totalpage','url'));

	if(!$list)$temp="erro.html";
	$smarty->_display($temp);
?>